
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
.STYLE1 {font-size: 24px}
.STYLE2 {font-size: 70px}
.STYLE7 {font-size: smaller}
.STYLE6 {font-size: medium}
-->
</style>
 	
	<!-- start about us -->
		<?php
		//初始化模板参数:$this->aboutusTitle、$this->aboutusTitleImg
		$this->aboutusTitle = 
		'四川大学网上第二课堂的答疑系统是一个网上预定答疑系统，
		学生可根据自身需要选择相应科目，
		相应教师进行预定，
		届时老师会在相应教室安排答疑。';
		$this->aboutusTitleImg = $this->baseUrl().'/images/answersystemTitleImg.jpg';
		
		$aboutusLayout = new Zend_Layout();
		echo $aboutusLayout->render('/module/aboutus');
		?>
	<!-- end about us -->
	
	<!-- start logos -->
	<div class="logos">
		
	</div>
	<!-- end logos -->
	
	<!-- start content -->
	<div id="vg-content">

		<!-- start portfolio details -->
		<div id="portfolio-details" class="vg-page">
		
			<!-- start details -->
			<?php
				//	左侧信息
				$this->fromhref = '?fromhref=/answersystem/index';
				if($this->isloggin==true)
				{
				    $userinfoLayout = new Zend_Layout();
				    echo $userinfoLayout->render('/module/userinfo');
				}
				else 
				{
				    //左侧登录
					$loginLayout = new Zend_Layout();
					echo $loginLayout->render('/module/login');
				} 
			?>
			<article class="border-top c-four height-auto">
			
				<div class="vg-item-article vg-portfolio-details">
					<!-- title -->
					<!-- end title -->
					<!-- upload start -->
					<!-- upload ends -->
					<!-- download list -->
					
					<!-- enddownload list -->
					<!-- pager start -->
					
					<!-- pager end -->
					<div class="answersystemblock">
		<div class="studentquery">
		<form action="<?php echo $this->baseUrl().'/answersystem/index';?>" method="post">
		课程名称：<input type="text" id="class" name="class"/>
		学院：<select name="college">
     	 <?php
     	 	foreach ($this->collegearray as $key=>$value)
     	 	{
     	 	    echo '<option value='.$key.'>'.$value.'</option>';
     	 	} 
     	 ?>
     	 </select>
		教师名：<input type="text" id="teachername" name="teachername"/>
		<button type="submit">查看</button>
    	</form>
		</div>
		<div class="indexblock">
		<ul>
		<?php
			foreach($this->allapp as $app)
			{
			    if($app['status']!=1)
			    {
			        echo '<li><a href="'.$this->baseUrl().'/answersystem/studentdetail?id='.$app['id'].'#panswersystem">'.$this->collegearray[$app['college']].$app['teacher'].'老师';
			        if($app['status']==3)echo '[决定]';
			        else echo '[准备';
			        echo ']在'.gmdate('Y年m月d日H:i',$app['date']).'答疑-'.$app['class'].'</a></li>';
			    }
			} 
			//<li><a href="">计算机学院zhijian老师【决定】在2012年08月15日09:00答疑-电子技术</a></li>
		?>
			
		</ul>
		<?php 
			$this->pagerUrl = $this->baseUrl().'/answersystem/index';
			$this->pagerPara = '';
			$aboutusLayout = new Zend_Layout();
			echo $aboutusLayout->render('/module/pager');
		?>
		</div>
	</div>
			  </div>
				
			</article>
			<!-- end details -->
			
	  </div>
	  <!-- end portfolio details -->
	  <a name="panswersystem" id="panswersystem"></a>
		<div class="answersystemtableblock">
		<?php
			$requestid = "";
			if(isset($this->requestid))
			{
				$requestid = '?id='.$this->requestid;
			} 
		?>
		<form action="<?php echo $this->baseUrl().'/answersystem/studentdetail'.$requestid?>" method="post">
		<p id="squery" name="squery">在下表中登记 <button type="submit">提交登记</button></p>
		
		<div class="weekdays">
		<?php 
			date_default_timezone_set('Asia/Shanghai');
			$weekdayarray = array('周日','周一','周二','周三','周四','周五','周六');
			for($i = 0;$i<7;$i++)
			    echo '<h4>'.$weekdayarray[$i].'<p>'.gmdate('Y/m/d',strtotime($this->daybegin.'-0:0') + $i*24*3600).'</p></h4>'; 
		?>
		
		</div>
		<div class="classtime">
		<h4>第一大节</h4><h4>第二大节</h4><h4>第三大节</h4><h4>第四大节</h4><h4>第五大节</h4>
		</div>
		<div class="table">
			<!-- 
			<div class="grid1"><p align="center" id="p1">计算机学院</p><p align="center" id="p2">冯伟森(25)</p><p align="center" id="p3">离散数学</p><p id="sregister" name="sregister">登记<input type="checkbox"/></p></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			<div class="grid"></div><div class="grid2"><p align="center" id="p1">计算机学院</p><p align="center" id="p2">冯伟森(25)</p><p align="center" id="p3">离散数学</p></div><div class="grid1"><p align="center" id="p1">计算机学院</p><p align="center" id="p2">冯伟森(25)</p><p align="center" id="p3">离散数学</p><p id="sregister" name="sregister">登记<input type="checkbox"/></p></div><div class="grid"></div><div class="grid"></div><div class="grid"></div><div class="grid"></div>
			
			 -->
			 
			 <?php
			 		$this->allapp = $this->alltableapp;//重名了，难得改了
			 	    $classtime = $this->classtime;
			 	    date_default_timezone_set('Asia/Shanghai');
			 	    $daybegin = $this->daybegin;
			 	    for($class=0;$class<5;$class++)//注意是从周日开始的
			 	    { 
			 	        for($weekday=0;$weekday<7;$weekday++)
			 	        {
			 	            $time = $daybegin.'-'.$classtime[$class];
			 	            $timecmp = strtotime($time)+$weekday*24*3600;
			 	            if($timecmp<=time()+8*3600)
			 	            {
			 	                echo '<div class="grid">';
			 	                echo '</div>';
			 	                //echo gmdate('Y-m-d H:i:s',$timecmp).'</br>'.gmdate('Y-m-d H:i:s',time()+8*3600).'</div>';
			 	                
			 	            }
			 	            else 
			 	            {
			 	                $find = false;
			 	                if(isset($this->allapp))
			 	                {
			 	                    foreach($this->allapp as $key => $app)			 	         
			 	                	{
			 	                    	if($app['date']==$timecmp)
			 	                    	{
			 	                    	    $findindex = $key;
			 	                    	    $find = true;
			 	                    	    break;
			 	                    	}
			 	                	}
			 	                }
			 	                if(!$find)echo '<div class="grid"></div>';
			 	                else 
			 	                {
									if($this->allapp[$findindex]['status']==2)
									{
									    //
									    //echo '<div class="grid1"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p><a href="'.$this->baseUrl().'/answersystem/teachercancel?id='.$this->allapp[$findindex]['id'].'">[取消]</a><a href="'.$this->baseUrl().'/answersystem/teachersure?id='.$this->allapp[$findindex]['id'].'">[决定]</a></div>';
									     echo '<div class="grid1"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p>';
									     $id = $this->allapp[$findindex]['id'];
									     if(isset($this->hasregist["$id"])&&$this->hasregist["$id"]==true)
									     	echo '<a>&nbsp[您已登记]</a>';
									     else echo '<p id="sregister" name="sregister">登记<input type="checkbox" id="'.$this->allapp[$findindex]['id'].'" name="'.$this->allapp[$findindex]['id'].'"/>';
									     echo '</p></div>';			 	                    
									}
									else if($this->allapp[$findindex]['status']==3)
									{
									    //echo '<div class="grid2"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p><a>[已定]</a><a href="'.$this->baseUrl().'/answersystem/teachercancel?id='.$this->allapp[$findindex]['id'].'">[取消]</a></div>';
										echo '<div class="grid2"><p align="center" id="p1">'.$this->collegearray[$this->allapp[$findindex]['college']].'</p><p align="center" id="p2">'.$this->allapp[$findindex]['teacher'].'('.$this->allapp[$findindex]['countstudent'].')</p><p align="center" id="p3">'.$this->allapp[$findindex]['class'].'</p><a>&nbsp&nbsp&nbsp[已定]</a></div>';
									}
									else echo '<div class="grid"></div>';
			 	                }
			 	            }
			 	            //echo $timecmp.'</br>';
									 	        
			 	        }
			 	        
			 	    }
			 	    //print_r($class);
			 	    //echo gmdate('Y-m-d H:i:s',1344470400 + 3600*8).'</br>';
			 	    //echo gmdate('Y-m-d H:i:s',1344398460 + 3600*8);
			 	    //echo strtotime('2012/8/1-'.$classtime[0]);
			 	    //echo gmdate('Y-m-d H:i:s',strtotime('2012/8/1-'.$classtime[0]));
			 ?>
		</div>
		</form>
	</div>	
	</div>
	<!-- end content -->

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-23864149-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  function searchEnter(){
	if(event.keyCode==13){
		document.getElementById('searchform').submit();
		return false;
	}  
  }
</script>
